package com.etl.dataflow.executor.communication;

import cn.hutool.core.lang.UUID;
import com.etl.dataflow.common.util.IpUtil;

import java.nio.charset.StandardCharsets;

/**
 * 执行器唯一标识单例
 *
 * @author dx
 * @since 2022/4/20
 */
public class ExecutorMark {
    private static final ExecutorMark INSTANCE = new ExecutorMark(
            UUID.nameUUIDFromBytes(IpUtil.getIpAddress().getBytes(StandardCharsets.UTF_8)).toString(true)
    );

    private final String uuid;

    private ExecutorMark(String uuid) {
        this.uuid = uuid;
    }

    public static ExecutorMark getInstance() {
        return INSTANCE;
    }

    public String getUuid() {
        return this.uuid;
    }
}
